Cesium Widget Example

This is an example notebook accessing the CesiumWidget, in the way it should be accessed.


In [2]:
import json
from IPython import display
from CesiumWidget import CesiumWidget

If the installation of Cesiumjs is ok, it should be reachable here.

Great, let's create a CesiumWidget!


In [3]:
cesium = CesiumWidget()

Display the widget:


In [4]:
cesium

You can change many settings of the widget:


In [5]:
cesium.class_own_traits()


Out[5]:
{'_flyto': <traitlets.traitlets.List at 0x41ca4a8>,
 '_view_module': <traitlets.traitlets.Unicode at 0x41ca2b0>,
 '_view_name': <traitlets.traitlets.Unicode at 0x41ca278>,
 '_zoomto': <traitlets.traitlets.List at 0x41ca400>,
 '_zoomtoregion': <traitlets.traitlets.List at 0x41ca630>,
 'animation': <traitlets.traitlets.Bool at 0x41ca6a0>,
 'base_layer_picker': <traitlets.traitlets.Bool at 0x41ca6d8>,
 'czml': <traitlets.traitlets.Tuple at 0x41ca2e8>,
 'enable_lighting': <traitlets.traitlets.Bool at 0x41ca940>,
 'geocoder': <traitlets.traitlets.Bool at 0x41ca710>,
 'geojson': <traitlets.traitlets.Unicode at 0x41ca3c8>,
 'home_button': <traitlets.traitlets.Bool at 0x41ca748>,
 'infobox': <traitlets.traitlets.Bool at 0x41ca780>,
 'kml_url': <traitlets.traitlets.Unicode at 0x41ca390>,
 'navigation_help_button': <traitlets.traitlets.Bool at 0x41ca860>,
 'navigation_instructions_initially_visible': <traitlets.traitlets.Bool at 0x41ca898>,
 'scene_3D_only': <traitlets.traitlets.Bool at 0x41ca8d0>,
 'scene_mode': <traitlets.traitlets.CaselessStrEnum at 0x41ca908>,
 'scene_mode_picker': <traitlets.traitlets.Bool at 0x41ca7b8>,
 'selection_indicator': <traitlets.traitlets.Bool at 0x41ca7f0>,
 'timeline': <traitlets.traitlets.Bool at 0x41ca828>}

Let's turn on lighting: let there be light!


In [5]:
cesium.enable_lighting = True

Load data for the viewer to display in the CZML format, which is based on JSON. It always expects a list of Packet objects.


In [6]:
from CesiumWidget.examples.iss import ISS
cesium.czml = ISS

You can also use the excellent czml module to generate valid CZML: see an example here.